# coding: utf-8
from sqlalchemy import Column, Date, DateTime, Integer, String
from sqlalchemy.dialects.mysql import TINYINT, VARCHAR
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()
metadata = Base.metadata


class TbUser(Base):
    __tablename__ = 'tb_user'
    __table_args__ = {'comment': 'ϵͳ����Ա��Ϣ��'}

    User_ID = Column(VARCHAR(10), primary_key=True, comment='�û�ID')
    User_Name = Column(VARCHAR(10), comment='�û���')
    User_PWD = Column(VARCHAR(50), comment='����')
    User_Role = Column(VARCHAR(10), comment='�û���ɫ')
    Belong_Depart = Column(VARCHAR(100), comment='���ڲ���')
    Job_Name = Column(VARCHAR(50), comment='���ڸ�λ')
    User_TruName = Column(VARCHAR(10), comment='��ʵ����')
    User_MobileNumber = Column(String(20), comment='�ֻ�����')
    User_Email = Column(VARCHAR(50), comment='��������')
    Register_Date = Column(Date, comment='ע������')
    IsQualified = Column(TINYINT, comment='��Ȩ״̬')
    Check_Date = Column(Date, comment='�������')
    Check_Name = Column(String(255), comment='���������')
    Update_Date = Column(Date, comment='��������')
    Remark = Column(String(255), comment='��ע')
    LegalPerson_ID = Column(Integer, comment='����ID')


class TbAdministrator(Base):
    __tablename__ = 'tb_administrator'
    __table_args__ = {'comment': '�û���Ϣ��'}

    User_ID = Column(String(10), primary_key=True, comment='�û�ID')
    User_Name = Column(VARCHAR(10), comment='�û���')
    User_PWD = Column(VARCHAR(50), comment='����')
    User_Role = Column(VARCHAR(10), comment='�û���ɫ')
    Belong_Depart = Column(VARCHAR(100), comment='���ڲ���')
    Job_Name = Column(VARCHAR(50), comment='���ڸ�λ')
    User_TruName = Column(VARCHAR(10), comment='��ʵ����')
    User_MobileNumber = Column(String(11), comment='�ֻ�����')
    User_Email = Column(VARCHAR(50), comment='��������')
    Register_Date = Column(Date, comment='ע������')
    IsQualified = Column(TINYINT, comment='��Ȩ״̬')
    Check_Date = Column(Date, comment='�������')
    Check_Name = Column(VARCHAR(50), comment='���������')
    Update_Date = Column(DateTime, comment='��������')
    Remark = Column(VARCHAR(200), comment='��ע')
    LegalPerson_ID = Column(Integer, comment='����ID')


class TbDbversion(Base):
    __tablename__ = 'tb_dbversion'
    __table_args__ = {'comment': '���汾��Ϣ'}

    sysDB_modName = Column(VARCHAR(30), primary_key=True, nullable=False, comment='ϵͳ��ģ����')
    sysDB_Version = Column(VARCHAR(20), primary_key=True, nullable=False, comment='ϵͳ��汾��')
    Release_Date = Column(Date, comment='��������')
    Remarks = Column(VARCHAR(200), comment='��ע')


class TbLicense(Base):
    __tablename__ = 'tb_license'
    __table_args__ = {'comment': '��Ȩ��Ϣ��'}

    LegalPerson_ID = Column(Integer, primary_key=True, comment='����ID')
    LegalPeson_Name = Column(VARCHAR(50), comment='��������')
    LegalPeson_Code = Column(VARCHAR(20), comment='��������')
    LegalPeson_Representative = Column(VARCHAR(10), comment='���˴���')
    Auth_serial_number = Column(String(100), comment='��Ȩ���к�')
    IsQualified = Column(TINYINT, comment='��Ȩ״̬')
    Authed_StartDate = Column(Date, comment='��Ȩ����')
    Authed_EndDate = Column(Date, comment='��Ȩ��ֹ����')
    Authed_Online_Number = Column(Integer, comment='�޶�������')
    user_db_constr = Column(VARCHAR(200), comment='�û������Ӵ�')
    Auth_devname = Column(VARCHAR(10), comment='��Ȩ��')
    License_Remarks = Column(VARCHAR(100), comment='��Ȩ˵��')


class TbUserorgFramework(Base):
    __tablename__ = 'tb_userorg_framework'
    __table_args__ = {'comment': '�û���֯������Ϣ��'}

    Depart_ID = Column(VARCHAR(10), primary_key=True, comment='����ID')
    Depart_Name = Column(VARCHAR(50), comment='��������')
    Depart_Rank = Column(VARCHAR(10), comment='���Ų㼶')
    Belong_Depart_ID = Column(String(5), comment='��������ID')
    Remark = Column(VARCHAR(200), comment='��ע')
    LegalPerson_ID = Column(Integer, comment='����ID')
